package com.dubious.interview.euler;

import com.dubious.interview.euler.prime.SievePrimeIterator;

public class Problem10 {

    /**
     * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
     * 
     * Find the sum of all the primes below two million.
     */
    public static long run(int upperBound) {

        long sum = 0;
        for(Long prime : new SievePrimeIterator(upperBound))
        {
            sum += prime;
        }

        return sum;
    }
}
